package com.cy.Service;

import com.cy.dao.DeptDao;
import com.cy.entity.Dept;
import com.cy.entity.Emp;
import com.cy.entity.Tj;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService{
    @Autowired
    DeptDao dao;

    @Override
    public PageInfo<Emp> list(Tj tj, Integer pageNum) {
        PageHelper.startPage(pageNum,2);
        List<Emp> list = dao.list(tj);
        PageInfo<Emp> page = new PageInfo<>(list);
        return page;
    }

    @Override
    public List<Dept> dept() {
        return dao.dept();
    }

    @Override
    public void del(Integer id) {
        dao.del(id);
    }

    @Override
    public void insert(Emp emp) {
        dao.insert(emp);
    }

    @Override
    public Emp sel(Integer id) {
        return dao.sel(id);
    }

    @Override
    public void update(Emp emp) {
        dao.update(emp);
    }
}
